package com.sunye.elasticsearch.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sunye.elasticsearch.entity.EsDogSellingPoint;
import com.sunye.elasticsearch.entity.EsDogSellingPointIndex;
import com.sunye.mongodb.MongoDogSellingPointIndex;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author sunye
 * @since 2022-07-13
 */
@Component
public interface EsDogSellingPointMapper extends BaseMapper<EsDogSellingPoint> {

    @Select("<script> SELECT selling_point_id,advantage,advantage_describe " +
            "FROM es_dog_selling_point where selling_point_id in <foreach item='item' index='index' collection='params' open='(' separator=',' close=')'>#{item}</foreach> </script>")
    List<EsDogSellingPointIndex> getSellingPoint(@Param("params") List<String> params);

    @Select("SELECT selling_point_id,advantage,advantage_describe FROM es_dog_selling_point where selling_point_id = #{id} ")
    EsDogSellingPoint getEsDogSellingPointById(String id);


    @Select("<script> SELECT selling_point_id,advantage,advantage_describe " +
            "FROM es_dog_selling_point where selling_point_id in <foreach item='item' index='index' collection='params' open='(' separator=',' close=')'>#{item}</foreach> </script>")
    List<MongoDogSellingPointIndex> getMongoSellingPoint(@Param("params") List<String> params);
}
